﻿#region Using Directives

using System;
using System.Linq;
using System.Collections.Generic;

using Microsoft.SharePoint;

#endregion Using Directives

namespace SharePointStu.ItemAuditing.Audit
{
    class ItemAuditEntries : AbstractAuditEntries
    {
        #region Constructor

        public ItemAuditEntries(Guid webId, Guid listId) : base(webId, listId)
        {
        }

        #endregion Constructor

        #region Overridden Methods

        public override List<AuditColumn> DefineColumns()
        {
            List<AuditColumn> columns = base.DefineColumns();
            AuditColumn column = columns.First(a => a.Name == COLUMN_LOCATION);

            if (column != null)
            {
                columns.Remove(column);
            }

            return columns;
        }

        public override string GetFilterColumns()
        {
            string filter = base.GetFilterColumns();
            if (filter.Contains(COLUMN_LOCATION))
            {
                filter = filter.Replace(" ", string.Empty).Replace(COLUMN_LOCATION + ",", string.Empty);
            }
            return filter;
        }

        #endregion Overridden Methods
    }
}
